package com.zhuangjie.openfeign.config;

import com.zhuangjie.security.helper.ModuleSecurityHelper;
import feign.RequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * openFeign请求头配置
 *
 * @author zhuangjie
 * @date 2023/11/25
 */
@Configuration
public class OpenFeignRequestHeaderConfiguration {

    @Bean
    public RequestInterceptor requestInterceptor() {
        // 设置安全模块访问TOKEN
        return template -> ModuleSecurityHelper.moduleSecurityAccessTokenProvider(template::header);
    }

}
